#pragma once
#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <strings.h>
#include <cstdlib>
#include <unordered_map>
#include <list>
#include <arpa/inet.h>
#include <unistd.h>
#include "log.hpp"
#include <string.h>
#include <queue>
#include "ThreadPool.hpp"

using namespace std;

enum EXITNUM
{
    SOCK_CREATE_ERROR = 1,
    SOCK_BIND_ERROR,
    SOCK_LISTEN_ERROR
};

class Analyze
{
private:
    struct sockaddr_in aim;
    string _ip;
    uint16_t _port;

public:
    Analyze(struct sockaddr_in& temp)
        :aim(temp)
    {
        _ip = inet_ntoa(aim.sin_addr);
        _port = ntohs(aim.sin_port);
    }

    bool operator==(const Analyze& temp)
    {
        if(_ip == temp.getip() && _port == temp.getport())
            return true;
        return false;
    }

    string getip() const {return _ip;}
    uint16_t getport() const {return _port;}
    struct sockaddr_in getsock() {return aim;}

    ~Analyze()
    {}

};